# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=unicodedata2
pkgbase=mingw-w64-python2-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-python2-${_realname}"
pkgver=12.1.0
pkgrel=1
pkgdesc='unicodedata backport/updates (mingw-w64)'
arch=('any')
url="https://github.com/mikekap/${_realname}"
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-python2")
makedepends=("${MINGW_PACKAGE_PREFIX}-cython2" "${MINGW_PACKAGE_PREFIX}-python2-setuptools")
source=("${_realname}-$pkgver.tar.gz"::"https://github.com/mikekap/unicodedata2/archive/$pkgver.tar.gz")
sha256sums=('1adaa55c908987a6657900d9f02d91ec71f79acdc292239440b2519b61a10852')

prepare() {
  rm -rf python2-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python2-build-${CARCH}"
}

build() {
   cd "$srcdir/python2-build-${CARCH}"
   MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
     ${MINGW_PREFIX}/bin/python2 setup.py build
}

check() {
   cd "$srcdir/python2-build-${CARCH}"
   ${MINGW_PREFIX}/bin/python2 setup.py test
}

package() {
   cd "$srcdir/python2-build-${CARCH}"
   MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
     ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
       --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}
